/*
 * @Description: api 管理
 * @Author: zheng yiliang
 * @Date: 2021-04-26 20:48:11
 * @LastEditTime: 2021-06-13 17:48:16
 * @LastEditors: zheng yiliang
 */
import axios from '@/plugins/axios'

// 获取文章类别目录
export const categoryQry = req => {
  return axios.get('categoryQry')
}

// 获取所有文章列表
export const articlesgory = req => {
  return axios.get('articlesgory', { params: req })
}

// 获取最新文章 （约三个月内的文章）
export const newArticlesQry = req => {
  return axios.get('newArticlesQry', { params: req })
}

// 获取文章详情
export const getArticleById = req => {
  return axios.get('getArticleById', { params: { id: req } })
}

// 获取归档列表
export const archivesQry = req => {
  return axios.get('archivesQry')
}

// 获取分类名称
export const categoryById = req => {
  return axios.get('categoryById', { params: { id: req } })
}

// 获取热门文章
export const hotArticlesQry = req => {
  return axios.get('hotArticlesQry')
}

// 获取上一篇下一篇
export const preAndNext = req => {
  return axios.get('preAndNext', { params: { id: req } })
}

// 新增一级评论
export const addComments = req => {
  return axios.post('addComments', req)
}

// 新增二级评论
export const replyComments = req => {
  return axios.post('replyComments', req)
}

// 根据文章id查询评论
export const commentsByArticle = req => {
  return axios.get('commentsByArticle', { params: { article_id: req } })
}

// 新增一级留言
export const addMessage = req => {
  return axios.post('addMessage', req)
}

// 新增二级评论
export const replyMessage = req => {
  return axios.post('replyMessage', req)
}

// 根据文章id查询评论
export const messages = req => {
  return axios.get('messages', { params: req })
}

// 友情链接
export const links = req => {
  return axios.get('links', { params: req })
}

// 消息通知
export const news = req => {
  return axios.get('news', { params: req })
}

// 标记已读
export const commentsRead = req => {
  return axios.put('commentsRead', req)
}

// 留言标记已读
export const messagesRead = req => {
  return axios.put('messagesRead', req)
}

// 最近访客
export const recentVisitors = req => {
  return axios.get('recentVisitors', { params: req })
}
